package cn.niit.letuseatdemo.service.impl;

import cn.niit.letuseatdemo.entity.domain.SysDictData;
import cn.niit.letuseatdemo.mapper.SysDictDataMapper;
import cn.niit.letuseatdemo.service.SysDictDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
  * @Description: 字典数据Service业务层处理
  * @Author: su_fuming
  * @CreateTime: 2022/11/29 14:15
 * @param: null
 * @return: null
  **/
@Service("SysDictDataService")
public class SysDictDataServiceImpl implements SysDictDataService
{
    @Autowired
    private SysDictDataMapper sysDictDataMapper;

    /**
     * 查询字典数据
     * 
     * @param dictCode 字典数据主键
     * @return 字典数据
     */
    @Override
    public SysDictData selectSysDictDataByDictCode(Long dictCode)
    {
        return sysDictDataMapper.selectSysDictDataByDictCode(dictCode);
    }

    /**
     * 根据字典类型和字典键值查询字典数据信息
     *
     * @param dictType 字典类型
     * @param dictValue 字典键值
     * @return 字典标签
     */
    @Override
    public String selectDictLabel(String dictType, String dictValue) {
        System.out.println("请求的参数是： dictType = " + dictType + " , dictValue = " + dictValue);
        return sysDictDataMapper.selectDictLabel(dictType, dictValue);
    }

    /**
     * 根据字典类型查询字典数据
     *
     * @param dictType 字典类型
     * @return 字典数据集合信息
     */
    @Override
    public List<SysDictData> selectDictDataByType(String dictType) {
        return sysDictDataMapper.selectDictDataByType(dictType);
    }

    /**
     * 查询字典数据列表
     * 
     * @param sysDictData 字典数据
     * @return 字典数据
     */
    @Override
    public List<SysDictData> selectSysDictDataList(SysDictData sysDictData)
    {
        return sysDictDataMapper.selectSysDictDataList(sysDictData);
    }

    /**
     * 新增字典数据
     * 
     * @param sysDictData 字典数据
     * @return 结果
     */
    @Override
    public int insertSysDictData(SysDictData sysDictData)
    {
        return sysDictDataMapper.insertSysDictData(sysDictData);
    }

    /**
     * 修改字典数据
     * 
     * @param sysDictData 字典数据
     * @return 结果
     */
    @Override
    public int updateSysDictData(SysDictData sysDictData)
    {
        return sysDictDataMapper.updateSysDictData(sysDictData);
    }

    /**
     * 删除字典数据信息
     * 
     * @param dictCode 字典数据主键
     * @return 结果
     */
    @Override
    public int deleteSysDictDataByDictCode(Long dictCode)
    {
        return sysDictDataMapper.deleteSysDictDataByDictCode(dictCode);
    }
}